﻿<%@ Page Language="C#" MasterPageFile="~/Safty/MasterPage.master" AutoEventWireup="true" CodeFile="Modify.aspx.cs" Inherits="Safty_Modify" Title="无标题页" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">
        var template = '<span style="color:{0};">{1}</span>';

        var Shenhe = function (value) {
            if(value==0){return String.format(template,'red', '未审');}
            if(value==1){return String.format(template,'green', '同意');}
            if(value==2){return String.format(template,'blue', '退回');}
        }
    </script>
    <ext:Store ID="Store1" OnRefreshData="Store1_OnRefreshData" runat="server">
        <Reader>
            <ext:JsonReader ReaderID="id">
                <Fields>
                    <ext:RecordField Name="id" Type="Int"></ext:RecordField>
                    <ext:RecordField Name="en_username" Type="String"></ext:RecordField>
                    <ext:RecordField Name="en_department" Type="String"></ext:RecordField>
                    <ext:RecordField Name="dept_master_status" Type="Int"></ext:RecordField>
                    <ext:RecordField Name="safty_master_status" Type="Int"></ext:RecordField>
                    <ext:RecordField Name="boss_status" Type="Int"></ext:RecordField>
                    <ext:RecordField Name="intime" Type="Date"></ext:RecordField>
                </Fields>
            </ext:JsonReader>
        </Reader>
        <AutoLoadParams>
            <ext:Parameter Name="start" Mode="Raw" Value="0" />
             <ext:Parameter Name="limit" Mode="raw" Value="20" />
        </AutoLoadParams>
    </ext:Store>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:CXDB %>" 
        SelectCommand="SELECT [uID], [username] FROM [CX_UserBase] WHERE (([DEPID] = @DEPID) AND ([LevelID] = @LevelID))">
        <SelectParameters>
            <asp:Parameter DefaultValue="6" Name="DEPID" Type="Int32" />
            <asp:Parameter DefaultValue="1" Name="LevelID" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <ext:Store ID="Store2" DataSourceID="SqlDataSource2" AutoLoad="true" runat="server">
        <Reader>
            <ext:JsonReader ReaderID="uID">
                <Fields>
                    <ext:RecordField Name="uID" Type="Int"></ext:RecordField>
                    <ext:RecordField Name="username" Type="String"></ext:RecordField>
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:ViewPort runat="server">
        <Body>
            <ext:ColumnLayout ID="ColumlayOut1" Split="true" FitHeight="true" runat="server">
                <Columns>
                    <ext:LayoutColumn ColumnWidth="0.5">
                        <ext:Panel ID="Panel1" Frame="true" runat="server" Height="500">
                            <Body>
                                <ext:GridPanel ID="GridPanel1" Frame="true" Title="我提交的安监档案列表" StoreID="Store1" Height="500" runat="server">
                                    <ColumnModel>
                                        <Columns>
                                            <ext:Column ColumnID="id" DataIndex="id" Header="档案编号"></ext:Column>
                                            <ext:Column ColumnID="en_department" DataIndex="en_department" Header="档案部门"></ext:Column>
                                            <ext:Column ColumnID="en_username" DataIndex="en_username" Header="员工姓名"></ext:Column>
                                            <ext:Column ColumnID="safty_master_status" DataIndex="safty_master_status" Header="安监领导">
                                            <Renderer Fn="Shenhe" />
                                            </ext:Column>
                                            <ext:Column ColumnID="dept_master_status" DataIndex="dept_master_status" Header="部门领导">
                                            <Renderer Fn="Shenhe" />
                                            </ext:Column>
                                            <ext:Column ColumnID="boss_status" DataIndex="boss_status" Header="公司领导">
                                            <Renderer Fn="Shenhe" />
                                            </ext:Column>
                                            <ext:Column ColumnID="intime" DataIndex="intime" Header="提交时间">
                                            <Renderer Fn="Ext.util.Format.dateRenderer('Y-m-d')" />
                                            </ext:Column>
                                            <ext:CommandColumn>
                                                <Commands>
                                                    <ext:GridCommand Text="删除" Icon="Delete"  CommandName="del">
                                                                                                            
                                                    </ext:GridCommand>
                                                </Commands>
                                            </ext:CommandColumn>
                                      </Columns>
                                    </ColumnModel>
                                    <SelectionModel>
                                        <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
                                            <AjaxEvents>
                                                <RowSelect OnEvent="RowSelect" Buffer="250">
                                                    <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="#{FormPanel1}" />
                                                    <ExtraParams>
                                                        <%-- or can use params[2].id as value --%>
                                                        <ext:Parameter Name="id" Value="this.getSelected().id" Mode="Raw" /> 
                                                    </ExtraParams>
                                                </RowSelect>
                                            </AjaxEvents>
                                        </ext:RowSelectionModel>
                                    </SelectionModel>
                                    
                                    <AjaxEvents>
                                        <Command OnEvent="DeleteRow" >
                                        <Confirmation Title="确认信息" ConfirmRequest="true" Message="确认删除吗？"  />
                                            <ExtraParams>
                                                <ext:Parameter Name="id" Value="record.data.id" Mode="Raw">
                                                </ext:Parameter> 
                                            </ExtraParams>
                                        </Command>
                                     </AjaxEvents>
                                  <BottomBar>
                                        <ext:PagingToolBar 
                                            ID="PagingToolBar1" 
                                            runat="server" 
                                            PageSize="20" 
                                            StoreID="Store1" 
                                            />
                                    </BottomBar>
                                    <LoadMask ShowMask="true" />
                                </ext:GridPanel>
                            </Body>
                        </ext:Panel>
                    </ext:LayoutColumn>
                    <ext:LayoutColumn ColumnWidth="0.5">
                        <ext:Panel ID="Panel2" Frame="true" runat="server">
                            <Body>
                             <ext:FormPanel  ID="FormPanel1"  AutoScroll="true" Title="员工诚信档案记录表"  runat="server"   ButtonAlign="Right"
                                Frame="true" >
                                <Body>
                                    <ext:FormLayout ID="FormLayout1" runat="server">
                                        <ext:Anchor>
                                            <ext:Label ID="Tfusername" Disabled=true runat="server" FieldLabel="员工姓名"></ext:Label>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:Hidden ID="tfhiddenid" runat="server"></ext:Hidden>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:Hidden ID="tfhiddenguid" runat="server"></ext:Hidden>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:Label ID="TfDeptName" Disabled="true" runat="server" FieldLabel="所在部门">
                                            </ext:Label>
                                        </ext:Anchor> 
                                        <ext:Anchor>
                                            <ext:DateField ID="TfAccident_time" EmptyText="请选择时间"    FieldLabel="安全生产中的事故时间" runat="server">
                                            </ext:DateField>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:ComboBox ID="TfAccident_duty" Editable="false" EmptyText="请选择" Width="120" FieldLabel="安全生产中的事故责任类型" runat="server">
                                            <Items>
                                                <ext:ListItem Text="主要责任" />
                                                <ext:ListItem Text="次要责任" />
                                                <ext:ListItem Text="管理责任" />
                                            </Items>
                                            </ext:ComboBox>
                                        </ext:Anchor>
                                        <ext:Anchor Horizontal="100%">
                                            <ext:TextArea  ID="TfAccident_reason" FieldLabel="安全生产中的事故原因" runat="server">
                                            </ext:TextArea>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:FileUploadField ID="tffileupload" FieldLabel ="附件"  Width="200" runat="server"></ext:FileUploadField>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:Label ID="Label2" runat="server" FieldLabel="注意" Text="如果有支持以上各项评价的相关证明文件请统一打包压缩作为附件上传，方便审核。<br>建议以说明性文字作为附件文件名。为节约服务器空间，附件仅支持.zip和.rar文件格式"></ext:Label>
                                        </ext:Anchor>
                                         <ext:Anchor>
                                            <ext:Label ID="Label1" runat="server" FieldLabel="注意" Text="修改提交，请重新上传附件！"></ext:Label>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                             <ext:ComboBox 
                                                            FieldLabel="安监部领导" 
                                                            Width="150"
                                                            ID="TfSafty_MasterId" 
                                                            runat="server" 
                                                            StoreID="Store2" 
                                                            Editable="false"
                                                             Disabled="true"
                                                            DisplayField="username"
                                                            ValueField="uID"
                                                            TypeAhead="true" 
                                                            Mode="Local"
                                                            ForceSelection="true"
                                                            EmptyText="请选择..."
                                                            Resizable="true"
                                                            SelectOnFocus="true">
                                            </ext:ComboBox>   
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:Label runat="server" ID="tfsafty_master_status" FieldLabel="审核态度"></ext:Label>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:Label runat="server" ID="tfsafty_master_remark" FieldLabel="审核意见"></ext:Label>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:Label runat="server" ID="tfsafty_master_time" FieldLabel="时间"></ext:Label>
                                        </ext:Anchor>
                                    </ext:FormLayout>
                                </Body>
                                <Buttons>
                                    <ext:Button ID="Button1"   runat="server" Icon="Disk" Text="修改提交">
                                    <AjaxEvents>
                                        <Click OnEvent="SubReportAdd">
                                            <EventMask ShowMask="true" Msg="员工诚信档案记录表提交中..." MinDelay="1000" />
                                        </Click>
                                    </AjaxEvents>
                                    </ext:Button>
                                </Buttons>
                            </ext:FormPanel>
                            </Body>
                        </ext:Panel>
                    </ext:LayoutColumn>
                </Columns>
            </ext:ColumnLayout>
        </Body>
    </ext:ViewPort>
</asp:Content>

